﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>显示</title>
    <link href="~/EasyUI/themes/icon.css" rel="stylesheet" />
    <link href="~/EasyUI/themes/default/easyui.css" rel="stylesheet" />
    <script type="text/javascript" src="~/Scripts/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="~/EasyUI/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="~/Scripts/jquery.validate.min.js"></script>

    <script src="~/Scripts/Showdatetime.js"></script>
    <script type="text/javascript" src="~/Scripts/jquery.msgProcess.js"></script>

    <script type="text/javascript">
        $(function () {

            $("#btnserch").click(function () {
                $('#tbList').datagrid('load', {
                    typeid: $('#newstype').val(),
                    keyword: $('#txtkey').val()
                });
            })

            $('#editWindow').window('close');

            $("#tbList").datagrid({
                width: '800px',
                height: 'auto',
                fitColumns: true,
                striped: true,
                singleSelect: true,
                url: '/admin/UserInfo/UserInfoList',
                //queryParams:{},
                loadMsg: '数据加载中请稍后……',
                pagination: true,//启用分页，默认每页10行
                rownumbers: false,//显示行号.
                pageSize: 10,//设置 页容量为 5
                pageList: [5, 10, 20],//设置 页容量下拉框
                columns: [[

                    { field: 'id', title: 'id', width: 30 },
                    { field: 'pname', title: '期刊名', width: 120 },
                    { field: 'years', title: '年', width: 40 },
                    { field: 'num', title: '期次', width: 50 },
                    { field: 'userid', title: '用户', width: 50 },
                    {
                        field: 'downtiem', title: '下载时间', width: 120, formatter: function (value) {
                        var aa = eval('new ' + (value.replace(/\//g, '')));
                        return aa.format("yyyy-MM-dd hh:mm:ss");
                           }
                    },
                    {
                        field: 'downState', title: '云端状态', width: 60, formatter: function (value) {
                            if (value == 1) {
                                return "成功"
                            }
                            else if (value == 0) {
                                return "云加载中"
                            } 
                            else {
                                return "失败"

                            }
                        } },
                    { field: 'downMmsg', title: '其他消息', width: 60 },
                ]],
                toolbar: [
                    {
                        iconCls: 'icon-save',
                        text: "下载",
                        handler: downFile
                    }],
                onSelect: function (rowI, rowD) {
                    selectedRowIndex = rowI;//将选中行的下标 设置给全局变量
                }
                 
            });
        })

        //选中行的下标
        var selectedRowIndex = -1;


        //编辑按钮方法
        function detailRow() {
            //获取选中行里的数据！
            var rowData = $("#tbList").datagrid("getSelected");
            if (rowData) {
                window.location = "/admin/news/detailNews?id=" + rowData.id;

            }
        }

        //cz按钮方法
        function chongzi() {
            
            $("#editWindow").dialog();
        }
        //编辑按钮方法
        function closedit() {
            $('#editWindow').window('close');

        }

       

        //下载文件钮方法
        function downFile() {
            var rowData = $("#tbList").datagrid("getSelected");
            if (rowData) {
              
                window.location = "/admin/UserInfo/DownloadFile?downid=" + rowData.id;
                //$.ajax({
                //    url: '/admin/UserInfo/DownloadFile',
                //    type: 'post',
                //    async: false,
                //    data: {
                //        downid: rowData.id
                //    },
                //    success: function (obj) {
                //        debugger;
                //        if (obj.Status == "err") {
                //            alert(obj.Msg);
                //        } else {
                //            alert("下载成功");
                //        }

                //    }
                //});
            }
            else {
                alert("请先选中行");
            }
            
        }
   
        



    </script>
</head>
<body>

    <div style=" margin:15px 0px 20px 50px">
        剩余下载次数：@ViewBag.downNum,   <input id="btcz" type="button" onclick="chongzi()" value="充值" />
        <br>
        标题：<input id="txtkey" type="text" /> &nbsp; &nbsp;
        <input id="btnserch" type="button" value="搜索" />

    </div>


    <table id="tbList" style="width:auto;height:auto"></table>
    <div id="editWindow" class="easyui-window" title="My Window" style="width:600px;height:500px;"
         data-options="iconCls:'icon-save',modal:true">
        <img src="~/image/shoukuan2.jpg" />
        <br>
        <input type="radio" id="option1" name="option" value="1">
        <label for="option1"> 5元,下载1次</label><br>

        <input type="radio" id="option2" name="option" value="30">
        <label for="option2">30元,下载30次</label><br>

        <input type="radio" id="option3" name="option" value="360">
        <label for="option3">300元,下载360次</label><br>

        <input type="radio" id="option3" name="option" value="99999">
        <label for="option3">1000永久</label><br>
        <span style="color:red">注：付款请添加备注，输入自己的登录名<b>@ViewBag.loginname</b>错了无法到账。</span>
        <span >付款后刷新自动到账。如果充值失败发送右键到 59151596@qq.com</span>

        <button onclick="closedit()">关闭</button>
    </div>


</body>
</html>